<?php
/**
 * 夏日葵电商系统
 * http://www.xiarikui.com
 */
namespace Admin\Controller;
class ReleaseController extends BaseController {
    function index(){
		$mod = M('users_topic_release');
		$user_mod = M('users');
		$users_topic_mod = M('users_topic');
		$res = $list = array();
        $p = empty($_REQUEST['p']) ? 1 : $_REQUEST['p'];
        $size = empty($_REQUEST['size']) ? 20 : $_REQUEST['size'];
        $where = " 1 = 1 ";
        $res = $mod->where($where)->page("$p,$size")->select();	
		foreach((array)$res as $k=>$v){
			$res[$k]['title'] = $users_topic_mod->where(array('topic_id'=>$v['topic_id']))->getField('title');
			$res[$k]['user_name'] = $user_mod->where(array('id'=>$v['user_id']))->getField('user_name');
			$res[$k]['images'] = explode(',',$v['images']);
		}
        $count = $mod->where($where)->count();
        $pager = new \Think\Page($count, $size);
        $page = $pager->show();
        $this->assign('list', $res);
        $this->assign('page', $page);
        $this->display();
	}
}
